from django.http import HttpRequest,\
    HttpResponseRedirect, HttpResponseForbidden

from .base_exception import *


# def login(request, user, primary_key="id"):
#     if not isinstance(request, HttpRequest):
#         raise errIllegalObject
#
#     request.session['id'] = "{0}={1}".format(primary_key,
#                                              getattr(user, primary_key))
#
#
# def logout(request):
#     if not isinstance(request, HttpRequest):
#         raise errIllegalObject
#
#     if is_signed_in(request):
#         del request.session['id']
#
#
# def is_signed_in(request):
#     if not isinstance(request, HttpRequest):
#         raise errIllegalObject
#
#     uid = request.session.get('id')
#     if not uid:
#         return False
#
#     return True



